<?php
$AppUI			= Zend_Registry::get('AppUI');
if($AppUI->id <=0 || ($AppUI->id > 0 && $AppUI->type < 2)) {
	$this->_redirect(HOST_BACKEND);
}
$arrOk	= array();
$files 	= scandir(LOCALE_PHP_FOLDER);
if(isset($files)) {
	foreach($files as $val) {
		if($val != '.' && $val != '..') {
			include_once(LOCALE_PHP_FOLDER . '/' . $val);
			if(isset($arrLocale)) {
				$strJs	 	= str_replace('.php','.js',$val);
				$strFileJs 	= LOCALE_FOLDER . $strJs;
				
				if(file_exists($strFileJs)) @unlink($strFileJs);
				$strContent = '';
				foreach($arrLocale as $k=>$v) {
					if((int)$v > 0) {
						$strContent .= 'var ' . $k . '=' . $v . ";\n";
					} else {
						$strContent .= 'var ' . $k . '="' . $v . "\";\n";
					}
				}
				if($strContent != '') {
					@file_put_contents($strFileJs, $strContent);
					$arrOk[] = $strJs;
				}
				$arrLocale = null;
			}
			
		}
	}
}
$this->view->back 	= isset($_SESSION[SESSION_BACKURL]) ? $_SESSION[SESSION_BACKURL] : HOST_BACKEND;
$this->view->arrOk	= $arrOk;